package com.itheima.health.job;

import com.alibaba.dubbo.config.annotation.Reference;
import com.itheima.health.service.OrderSettingService;
import com.itheima.health.utils.DateUtils;
import org.springframework.stereotype.Component;

@Component
public class ClearOrderSettingDataJob {

    @Reference
    OrderSettingService orderSettingService;

    /*
    * 定时清理每月预约设置数据
    */
    public void clearOrderSettingData(){
        try {

            String lastDay4ThisMonth = DateUtils.parseDate2String(DateUtils.getLastDay4ThisMonth());
            orderSettingService.clearOrderSettingData(lastDay4ThisMonth);
            System.out.println("清理预约设置数据成功");
        } catch (Exception e) {
            e.printStackTrace();
            System.out.println("清理预约设置数据失败");
        }
    }
}
